package com.great.service.impl;

import com.github.pagehelper.PageHelper;
import com.great.dao.CateDao;
import com.great.domain.Cate;
import com.great.service.CateService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CateServiceImpl implements CateService {

   @Autowired
   private CateDao cateDao;

    @Override
    public List<Cate> findAllCate(int page,int size) {
        PageHelper.startPage(page, size);
        return cateDao.findAllCate();
    }

    @Override
    public List<Cate> findAllParentCate() {
        return  cateDao.findAllParentCate();
    }

    @Override
    public void addcate(Cate cate) {
        cateDao.addcate(cate);
    }

    @Override
    public Cate findById(int id) {
        return cateDao.findById(id);
    }

    @Override
    public void updatecate(Cate cate) {
        cateDao.updatecate(cate);
    }

    @Override
    public void delete(int id) {
        cateDao.delete(id);
    }
}
